import mitt from "mitt";

const emitter = mitt();

export function install({router}) {
  emitter.on('api.error', response => {
    if (response.status === 401) {
      router.push('/login');
    }
  });
}

export default emitter;
